struct DMOD
{
	UInt32		signature;								// file signature (DMOD)
	UInt16		version;								// current file version (0)
	
	UInt16		numPatchedFiles;						// number of files to be patched
	DMODFile	fileList[numPatchedFiles];				// data for all files
};

struct DMODFile
{
	char			name[32];							// file name
	UInt32			patchType;							// 0 = resource-based, 1 = raw patch
	
	if(patchType == 0)
	{
		UInt32				numPatchedResources;						// number of rsrcs to be patched
		DMODResource		resourceList[numPatchedResource];			// data for resources in file
		
		UInt32				numAddedResources;							// number of rsrcs to be added
		DMODResourceData	newResourceList[numAddedResources];			// data for new resources
		
		UInt32				numDeletedResources;						// number of rsrcs to be deleted
		UInt32				deletedResourceList[numDeletedResources];	// resource IDs of rsrcs to be deleted
	}
	
	if(patchType == 1)
	{
		UInt32			numPatches;							// number of patches
		DMODPatch		patchList[numPatches];				// the patches
		
		UInt32			appendSize;							// size of data to append
		UInt8			appendData[appendSize];				// the data to append
	}
};

struct DMODResource
{
	char			name[128];							// resource name
	UInt32			type;								// resource type
	UInt32			index;								// resource index
	UInt32			size;								// resource size
	UInt32			platform;							// 0 = platform independent, 1 = mac, 2 = pc
	
	UInt32			numPatches;							// number of patches in resource
	DMODPatch		patchList[numPatches];				// patch list
};

struct DMODPatch
{
	UInt32			offset;								// offset in to resource
	UInt32			size;								// data size
	
	UInt8			data[size];							// patch data
	
	// align to nearest 32-bit boundary
};

struct DMODResourceData
{
	char			name[128];							// resource name
	UInt32			type;								// resource type
	UInt32			index;								// resource index
	UInt32			platform;							// 0 = platform independent, 1 = mac, 2 = pc
	
	UInt32			size;								// data size
	UInt8			data[size];							// resource data
	
	// align to nearest 32-bit boundary
};
